﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace Sinacor.UI.HelpViewer.Service
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    public class PipeService : IPipeService
    {
        #region Attributes

        public static string URI = "net.pipe://localhost/HelpViewer";

        public delegate void DocumentHelpReadyEventHandler(string document);
        public DocumentHelpReadyEventHandler DocumentHelpReady = null;

        public delegate void LanguageChangedEventHandler(string language);
        public LanguageChangedEventHandler LanguageChanged = null;

        public delegate void ThemeChangedEventHandler(string theme);
        public ThemeChangedEventHandler ThemeChanged = null;

        #endregion

        #region Methods

        public void ShowHelp(string document)
        {
            if (DocumentHelpReady != null)
                DocumentHelpReady(document);
        }

        public void ChangeLanguage(string language)
        {
            if (LanguageChanged != null)
                LanguageChanged(language);
        }

        public void ChangeTheme(string theme)
        {
            if (ThemeChanged != null)
                ThemeChanged(theme);
        }

        #endregion
    }
}
